package com.carryking;

import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

/**
 * Created by jincarry on 2018/1/11.
 */
public class Main {

    public static void main(String[] args) throws InterruptedException {

        final ApplicationContext context = new ClassPathXmlApplicationContext("client.xml");

        for(int n=0;n<60;n++) {

            new Thread(new Runnable() {
                public void run() {

                    HelloService helloService = context.getBean(HelloService.class);

                    while (true) {
                        String result = helloService.hello("carryking", 18);

                        System.out.println(result);
                        try {
                            Thread.sleep(1000*5);
                        } catch (InterruptedException e) {
                            e.printStackTrace();
                            break;
                        }
                    }
                }
            }).start();

            Thread.sleep(1000);
        }

        Thread.sleep(Integer.MAX_VALUE);
    }

}
